<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象方法</title>
</head>
<body>
<p id = "demo"></p>

<script>
  var person = {
    firstName: "Bill",
    lastName: "Gates",
    id: 678,
  };
  <!--添加新的方法-->
  person.name = function (){
    return this.firstName + " " + this.lastName;
  };

  document.getElementById("demo").innerHTML =
          "My friends is" + person.name();
</script>
</body>
</html>